package com.sqrj.phoneorder.Controller;

import com.sqrj.phoneorder.common.JsonData;
import com.sqrj.phoneorder.common.JsonUtils;
import com.sqrj.phoneorder.model.SendTruckOUT;
import com.sqrj.phoneorder.param.SendCountParam;
import com.sqrj.phoneorder.service.SendTruckOUTService;
import com.sqrj.phoneorder.util.DateTimeUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class SendTruckOUTController {
    @Resource
    private SendTruckOUTService sendTruckOUTService;

//    查询商砼发货单记录
    @PostMapping("/querystSendRecord")
    public Map<String, Object> querystSendRecord(@RequestBody Map<String, Object> map) {
        String unitName = (String) map.get("unitName");
        Map<String, Object> modelMap = new HashMap<String, Object>();
        List<SendTruckOUT> sendTruckOUTList = sendTruckOUTService.querystSendRecord(unitName);
        modelMap.put("sendTruckOUTList",sendTruckOUTList);
        return  modelMap;
    }

//  查询商砼发货单汇总
    @PostMapping("/querystSendHZ")
    public Map<String, Object> querystSendHZ(@RequestBody Map<String, Object> map) {
        String unitName = (String) map.get("unitName");
        Map<String, Object> modelMap = new HashMap<String, Object>();
        List<SendTruckOUT> sendTruckOUTList = sendTruckOUTService.querystSendHZ(unitName);
        modelMap.put("sendTruckOUTList",sendTruckOUTList);
        return  modelMap;
    }

//  查询发货记录
    @PostMapping("/querySendRecord")
    public JsonData querySendRecord(@RequestBody SendCountParam sendCountParam) {

        List<SendTruckOUT> sendTruckOUTList = sendTruckOUTService.querySendRecord(sendCountParam);

        return  JsonData.success(sendTruckOUTList);
    }
}
